import time
import flappy_bird_gym
from stable_baselines3 import DQN,PPO,A2C,TD3,SAC,DDPG
env = flappy_bird_gym.make("FlappyBird-v0")

# obs = env.reset()
model = A2C(policy="MlpPolicy", env=env,verbose=1)
# model.load("test")
# model.learn(total_timesteps=100000)
model.save("test")

obs = env.reset()
# model = PPO(policy="MlpPolicy", env=env)
# model.load("test")
while True:
    action, state = model.predict(observation=obs)
    obs, reward, done, info = env.step(action)
    env.render()
    time.sleep(1 / 30)  # FPS
    if done:
        break

env.close()